package com.kaibes.platform.currency.db;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;

import com.kaibes.core.base.annotation.Description;

import lombok.Data;

/**
CREATE TABLE `currency_exchange` (
  `id` TINYINT UNSIGNED NOT NULL AUTO_INCREMENT,
  `from_id` TINYINT UNSIGNED DEFAULT NULL,
  `to_id` TINYINT UNSIGNED DEFAULT NULL,
  `change` MEDIUMINT UNSIGNED NOT NULL DEFAULT 1,
  PRIMARY KEY (`id`),
  FOREIGN KEY (`from_id`) REFERENCES `currency` (`id`) ON DELETE CASCADE,
  FOREIGN KEY (`to_id`) REFERENCES `currency` (`id`) ON DELETE CASCADE
) ENGINE=INNODB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;
 */
@Data
@Description("货币汇率")
public class CurrencyExchange {

    @Description("兑率ID")
    private Short id;
    @Description("原始货币ID")
    @NotNull(message = "原始货币不能为空")
    @Min(value = 1, message = "原始货币ID不能小于0")
    private Short fromId;
    @Description("兑换货币ID")
    @NotNull(message = "目标货币不能为空")
    @Min(value = 1, message = "目标货币ID不能小于0")
    private Short toId;
    @Description("兑换货币数量")
    @NotNull(message = "原始货币数量不能为空")
    @Min(value = 1, message = "目标货币数量不能小于0")
    private Integer change;
    
}
